import Taro, { Component } from '@tarojs/taro'
import { Swiper, SwiperItem, Image, View, Text,Picker,Input } from '@tarojs/components'
import '../../assets/common.scss'
import CommonJs from '../../utils/common'
import './join.scss'



export default class Index extends Component {
  constructor(props) {
    super(props);
    this.state = {
        ischange:'',
        info:{logo:'1'}
    }
  } 
  config = {
    navigationBarTitleText:'加载中'
  }
	
  componentWillMount () {
    var type =this.$router.preload.type;
// 	if(type==1){
// 		var jmtype='查看易商详情'
// 	}
// 	else if(type==2){
//    var jmtype='查看易栈详情'
// 	}
// 	else{
// 		var jmtype='查看易庄详情'
// 	}
		var jmtype='查看详情'
    Taro.setNavigationBarTitle({
      title:jmtype
    })
    this.setState({
	    ischange:type,
      jmtype:jmtype,
	  }) 
	  this.getimg(type)
  }
  componentDidShow () {
    
  }
  componentDidUpdate () {
  }
  getimg(type){
  	if(type==1){
  		var val=4
  	}
  	else if(type==2){
  		var val=6
  	}
  	else{
  		var val=5
  	}
  	var _this=this;
  	var url="/advert/aapi/v1.9/apply-setting/byType/"+val
  	CommonJs.ajaxRequest(url,'','GET',function(res){
  		if(res.data.length>0){
				_this.setState({
			    info:res.data[0]
			  }) 
			}
  		else{
  			_this.setState({
			    info:''
			  }) 
  		}
	  })
  }
  render () {
  	const info = this.state.info;
    return (
    	<View className='page'>
            <View className='qy-detail'>
             <View className='qy-box'>
                <View className='qy-img'>
                    <Image className="qy-imgs"  mode='widthFix' src={info.logo?info.logo:'https://xjzbsmall.g2ma.com//kedouimg/new_yishang.jpg'} style={this.state.ischange==1?'':'display:none'}></Image>
                    <Image className="qy-imgs"  mode='widthFix' src={info.logo?info.logo:'https://xjzbsmall.g2ma.com//kedouimg/yizhan20200813.jpg'} style={this.state.ischange==2?'':'display:none'}></Image>
                    <Image className="qy-imgs"  mode='widthFix' src={info.logo?info.logo:'https://xjzbsmall.g2ma.com//kedouimg/yizhuang20200813.jpg'} style={this.state.ischange==3?'':'display:none'}></Image>
                </View>
	         </View>
            </View>
      </View>
    )
  }
}
